home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / paintEffectsProperties.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  12.1 KB  |  493 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:    1998
  22. //  Author:            Duncan Brinsmead
  23. //
  24. //  Description:
  25. //
  26.  
  27. global proc strokeOptionsCallback( string $parent, string $whichCallback)
  28. {
  29.     global string $gCreatorWireCtx;
  30.     string $whichCtx = $gCreatorWireCtx;
  31.  
  32.     setParent $parent;
  33.     int $rval;
  34.     int $ival;
  35.     float $fval;
  36.     
  37.     
  38.     switch( $whichCallback )
  39.     {
  40.         case "Pmap1":
  41.         case "Pmap2":
  42.         case "Pmap3":
  43.             if( $whichCallback == "Pmap1" )
  44.                 $opt = `optionMenuGrp -q -v pressureMapping1`;
  45.             else if( $whichCallback == "Pmap2" )
  46.                 $opt = `optionMenuGrp -q -v pressureMapping2`;
  47.             else
  48.                 $opt = `optionMenuGrp -q -v pressureMapping3`;
  49.             if( $opt == "scale" )
  50.             {
  51.                 $rval = 1;
  52.             }
  53.             else if( $opt == "width" )
  54.             {
  55.                 $rval = 2;
  56.             }
  57.             else if( $opt == "softness" )
  58.             {
  59.                 $rval = 3;
  60.             }
  61.             else if( $opt == "color" )
  62.             {
  63.                 $rval = 4;
  64.             }
  65.             else if( $opt == "transparency" )
  66.             {
  67.                 $rval = 5;
  68.             }
  69.             else if( $opt == "tube width" )
  70.             {
  71.                 $rval = 6;
  72.             }
  73.             else if( $opt == "tube length" )
  74.             {
  75.                 $rval = 7;
  76.             }
  77.             else if( $opt == "incandescence" )
  78.             {
  79.                 $rval = 8;
  80.             }
  81.             else if( $opt == "glow spread" )
  82.             {
  83.                 $rval = 9;
  84.             }
  85.             else if( $opt == "tubes per step" )
  86.             {
  87.                 $rval = 10;
  88.             }
  89.             else if( $opt == "elevation" )
  90.             {
  91.                 $rval = 11;
  92.             }
  93.             else if( $opt == "azimuth" )
  94.             {
  95.                 $rval = 12;
  96.             }
  97.             else if( $opt == "path follow" )
  98.             {
  99.                 $rval = 13;
  100.             }
  101.             else if( $opt == "path attract" )
  102.             {
  103.                 $rval = 14;
  104.             }
  105.             else if( $opt == "random" )
  106.             {
  107.                 $rval = 15;
  108.             }
  109.             else if( $opt == "wiggle" )
  110.             {
  111.                 $rval = 16;
  112.             }
  113.             else if( $opt == "curl" )
  114.             {
  115.                 $rval = 17;
  116.             }
  117.             else if( $opt == "noise" )
  118.             {
  119.                 $rval = 18;
  120.             }
  121.             else if( $opt == "turbulence" )
  122.             {
  123.                 $rval = 19;
  124.             }
  125.             else if( $opt == "num twigs" )
  126.             {
  127.                 $rval = 20;
  128.             }
  129.             else if( $opt == "num leaves" )
  130.             {
  131.                 $rval = 21;
  132.             }
  133.             else if( $opt == "num petals" )
  134.             {
  135.                 $rval = 22;
  136.             }
  137.             else if( $opt == "surface offset" )
  138.             {
  139.                 $rval = 23;
  140.             }
  141.             else
  142.             {
  143.                 $rval = 0;
  144.             }
  145.             if( $whichCallback == "Pmap1" )
  146.                 dynWireCtx -e -pm1 $rval $whichCtx;
  147.             else if( $whichCallback == "Pmap2" )
  148.                 dynWireCtx -e -pm2 $rval $whichCtx;
  149.             else
  150.                 dynWireCtx -e -pm3 $rval $whichCtx;
  151.         break;
  152.         case "surfaceOffset":
  153.             $fval = `floatSliderGrp -q -v "surfaceOffset"`;
  154.             dynWireCtx -e -sof $fval $whichCtx;
  155.         break;
  156.         case "pressureMin1":
  157.             $fval = `floatSliderGrp -q -v "pressureMin1"`;
  158.             dynWireCtx -e -ps1 $fval $whichCtx;
  159.         break;
  160.         case "pressureMin2":
  161.             $fval = `floatSliderGrp -q -v "pressureMin2"`;
  162.             dynWireCtx -e -ps2 $fval $whichCtx;
  163.         break;
  164.         case "pressureMin3":
  165.             $fval = `floatSliderGrp -q -v "pressureMin3"`;
  166.             dynWireCtx -e -ps3 $fval $whichCtx;
  167.         break;
  168.         case "pressureMax1":
  169.             $fval = `floatSliderGrp -q -v "pressureMax1"`;
  170.             dynWireCtx -e -px1 $fval $whichCtx;
  171.         break;
  172.         case "pressureMax2":
  173.             $fval = `floatSliderGrp -q -v "pressureMax2"`;
  174.             dynWireCtx -e -px2 $fval $whichCtx;
  175.         break;
  176.         case "pressureMax3":
  177.             $fval = `floatSliderGrp -q -v "pressureMax3"`;
  178.             dynWireCtx -e -px3 $fval $whichCtx;
  179.         break;
  180.         case "displayQuality":
  181.             $fval = `floatSliderGrp -q -v "displayQuality"`;
  182.             dynWireCtx -e -dq $fval $whichCtx;
  183.         break;
  184.     }
  185. }
  186.  
  187. proc string getMapping( int $index )
  188. {
  189.     string $str;
  190.  
  191.     switch( $index )
  192.     {
  193.         case 1:
  194.             $str = "scale";
  195.         break;
  196.         case 2:
  197.             $str = "width";
  198.         break;
  199.         case 3:
  200.             $str = "softness";
  201.         break;
  202.         case 4:
  203.             $str = "color";
  204.         break;
  205.         case 5:
  206.             $str = "transparency";
  207.         break;
  208.         case 6:
  209.             $str = "tube width";
  210.         break;
  211.         case 7:
  212.             $str = "tube length";
  213.         break;
  214.         case 8:
  215.             $str = "incandescence";
  216.         break;
  217.         case 9:
  218.             $str = "glow spread";
  219.         break;
  220.         case 10:
  221.             $str = "tubes per step";
  222.         break;
  223.         case 11:
  224.             $str = "elevation";
  225.         break;
  226.         case 12:
  227.             $str = "azimuth";
  228.         break;
  229.         case 13:
  230.             $str = "path follow";
  231.         break;
  232.         case 14:
  233.             $str = "path attract";
  234.         break;
  235.         case 15:
  236.             $str = "random";
  237.         break;
  238.         case 16:
  239.             $str = "wiggle";
  240.         break;
  241.         case 17:
  242.             $str = "curl";
  243.         break;
  244.         case 18:
  245.             $str = "noise";
  246.         break;
  247.         case 19:
  248.             $str = "turbulence";
  249.         break;
  250.         case 20:
  251.             $str = "num twigs";
  252.         break;
  253.         case 21:
  254.             $str = "num leaves";
  255.         break;
  256.         case 22:
  257.             $str = "num petals";
  258.         break;
  259.         case 23:
  260.             $str = "surface offset";
  261.         break;
  262.         default:
  263.             $str = "off";
  264.         break;
  265.     }
  266.     return $str;
  267. }
  268.  
  269.  
  270. proc pressuremappings()
  271. {
  272.     menuItem -l "off" aOff;
  273.     menuItem -l "scale" aScale;
  274.     menuItem -l "width" aWidth;
  275.     menuItem -l "softness" aSoftness;
  276.     menuItem -l "color" aColor;
  277.     menuItem -l "transparency" aTransparency;
  278.     menuItem -l "tube width" aTubeWidth;
  279.     menuItem -l "tube length" aTubeLength;
  280.     menuItem -l "incandescence" aIncandescence;
  281.     menuItem -l "glow spread" aGlowSpread;
  282.     menuItem -l "tubes per step" aTubesPerStep;
  283.     menuItem -l "elevation" aElevation;
  284.     menuItem -l "azimuth" aAzimuth;
  285.     menuItem -l "path follow" aPathFollow;
  286.     menuItem -l "path attract" aPathAttract;
  287.     menuItem -l "random" aRandom;
  288.     menuItem -l "wiggle" aWiggle;
  289.     menuItem -l "curl" aCurl;
  290.     menuItem -l "noise" aNoise;
  291.     menuItem -l "turbulence" aTurbulence;
  292.     menuItem -l "num twigs" aNumTwigs;
  293.     menuItem -l "num leaves" aNumLeaves;
  294.     menuItem -l "num petals" aNumPetals;
  295.     menuItem -l "surface offset" aSurfaceOffset;
  296. }
  297.  
  298. global proc strokeOptionsUpdate( string $parent )
  299. {
  300.     string $str;
  301.     global string $gCreatorWireCtx;
  302.     string $whichCtx = $gCreatorWireCtx;
  303.     setParent $parent;
  304.  
  305.     $str = getMapping( `dynWireCtx -q -pm1 $whichCtx` );
  306.     optionMenuGrp -e -v $str "pressureMapping1";
  307.     $str = getMapping( `dynWireCtx -q -pm2 $whichCtx` );
  308.     optionMenuGrp -e -v $str "pressureMapping2";
  309.     $str = getMapping( `dynWireCtx -q -pm3 $whichCtx` );
  310.     optionMenuGrp -e -v $str "pressureMapping3";
  311.  
  312.     if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  313.         floatSliderGrp -e -v `dynWireCtx -q -sof $whichCtx` "surfaceOffset";
  314.     }
  315.     floatSliderGrp -e -v `dynWireCtx -q -ps1 $whichCtx` "pressureMin1";
  316.     floatSliderGrp -e -v `dynWireCtx -q -ps2 $whichCtx` "pressureMin2";
  317.     floatSliderGrp -e -v `dynWireCtx -q -ps3 $whichCtx` "pressureMin3";
  318.     floatSliderGrp -e -v `dynWireCtx -q -px1 $whichCtx` "pressureMax1";
  319.     floatSliderGrp -e -v `dynWireCtx -q -px2 $whichCtx` "pressureMax2";
  320.     floatSliderGrp -e -v `dynWireCtx -q -px3 $whichCtx` "pressureMax3";
  321.  
  322.     if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  323.         floatSliderGrp -e -v `dynWireCtx -q -dq $whichCtx` "displayQuality";
  324.         checkBoxGrp -e -v1 `dynWireCtx -q -pd $whichCtx` "paintAtDepth";
  325.     }
  326. }
  327.  
  328.  
  329. global proc paintEffectsProperties () {
  330. //
  331. //  Description:
  332. //        This procedure builds the property sheet and assigns callbacks to
  333. //        its controls.  The state of the controls are set in paintEffectsValues().
  334. //
  335. //
  336.  
  337.     string $parent = `toolPropertyWindow -q -location`;
  338.     setParent $parent;
  339.  
  340.     setUITemplate -pushTemplate OptionsTemplate;
  341.  
  342.     // create the top-level layout.  This must have the
  343.     // same name as the string returned from getClassName
  344.     columnLayout -adj true paintEffects; 
  345.     $parent += "/paintEffects";
  346.  
  347.     global string $gCreatorWireCtx;
  348.     string $whichCtx = $gCreatorWireCtx;
  349.  
  350.     columnLayout -adj true dynPaint_Tab;
  351.  
  352.         // context options for dynPaint.
  353.         //
  354.         frameLayout -collapsable true -collapse false
  355.             -l "Stroke Settings" dynPaintFrame;
  356.             columnLayout dynPaintOptions;
  357.                 separator -style "none";
  358.                 $parent = `setParent -query`;
  359.  
  360.                 if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  361.                     checkBoxGrp
  362.                         -label ""
  363.                         -l1 "Paint at Depth"
  364.                         -ncb 1
  365.                         -onc ("dynWireCtx -e -pd true " + $whichCtx)
  366.                         -ofc ("dynWireCtx -e -pd false " + $whichCtx)
  367.                         paintAtDepth;
  368.                     separator -style "none";
  369.                     floatSliderGrp -label "Display Quality"
  370.                              -field true
  371.                              -min 0.0 -max 100.0
  372.                              -fmn 0.0 -fmx 10000.0
  373.                              -v 100.0
  374.                              -precision 2
  375.                              -cc ("strokeOptionsCallback(\""
  376.                                     +$parent+"\",\"displayQuality\")")
  377.                              displayQuality;
  378.                     separator -style "none";
  379.                     floatSliderGrp -label "Surface Offset"
  380.                              -field true
  381.                              -min -1.0 -max 1.0
  382.                              -fmn -10000 -fmx 10000.0 
  383.                              -v 0.0
  384.                              -precision 4
  385.                              -cc ("strokeOptionsCallback(\""
  386.                                     +$parent+"\",\"surfaceOffset\")")
  387.                              surfaceOffset;
  388.                 }
  389.                 
  390.                 optionMenuGrp -l "Pressure Mapping 1"
  391.                   -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap1\")") 
  392.                                     pressureMapping1;
  393.                     pressuremappings();
  394.  
  395.                 floatSliderGrp -label "Pressure Min 1"
  396.                              -field true
  397.                              -min 0.0 -max 1.0
  398.                              -fmn -10000.0 -fmx 10000.0
  399.                              -v 0.0 
  400.                              -precision 4
  401.                              -cc ("strokeOptionsCallback(\""
  402.                                     +$parent+"\",\"pressureMin1\")")
  403.                              pressureMin1;
  404.  
  405.                 floatSliderGrp -label "Pressure Max 1"
  406.                              -field true
  407.                              -min 0.0 -max 1.0
  408.                              -fmn -10000.0 -fmx 10000.0
  409.                              -v 1.0 
  410.                              -precision 4
  411.                              -cc ("strokeOptionsCallback(\""
  412.                                     +$parent+"\",\"pressureMax1\")")
  413.                              pressureMax1;
  414.  
  415.                 optionMenuGrp -l "Pressure Mapping 2"
  416.                   -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap2\")") 
  417.                                     pressureMapping2;
  418.                     pressuremappings();
  419.  
  420.                 floatSliderGrp -label "Pressure Min 2"
  421.                              -field true
  422.                              -min 0.0 -max 1.0
  423.                              -fmn -10000.0 -fmx 10000.0
  424.                              -v 0.0 
  425.                              -precision 4
  426.                              -cc ("strokeOptionsCallback(\""
  427.                                     +$parent+"\",\"pressureMin2\")")
  428.                              pressureMin2;
  429.  
  430.                 floatSliderGrp -label "Pressure Max 2"
  431.                              -field true
  432.                              -min 0.0 -max 1.0
  433.                              -fmn -10000.0 -fmx 10000.0
  434.                              -v 1.0 
  435.                              -precision 4
  436.                              -cc ("strokeOptionsCallback(\""
  437.                                     +$parent+"\",\"pressureMax2\")")
  438.                              pressureMax2;
  439.  
  440.                 optionMenuGrp -l "Pressure Mapping 3"
  441.                   -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap3\")") 
  442.                                     pressureMapping3;
  443.                     pressuremappings();
  444.  
  445.                 floatSliderGrp -label "Pressure Min 3"
  446.                              -field true
  447.                              -min 0.0 -max 1.0
  448.                              -fmn -10000.0 -fmx 10000.0
  449.                              -v 0.0 
  450.                              -precision 4
  451.                              -cc ("strokeOptionsCallback(\""
  452.                                     +$parent+"\",\"pressureMin3\")")
  453.                              pressureMin3;
  454.  
  455.                 floatSliderGrp -label "Pressure Max 3"
  456.                              -field true
  457.                              -min 0.0 -max 1.0
  458.                              -fmn -10000.0 -fmx 10000.0
  459.                              -v 1.0 
  460.                              -precision 4
  461.                              -cc ("strokeOptionsCallback(\""
  462.                                     +$parent+"\",\"pressureMax3\")")
  463.                              pressureMax3;
  464.  
  465.                 separator -style "none";
  466.             setParent ..; // dynPaintOptions
  467.         setParent ..; // dynPaintFrame
  468.     setParent ..; // dynPaint_Tab
  469.  
  470.     setUITemplate -popTemplate;
  471.  
  472.     strokeOptionsUpdate( $parent );
  473.  
  474.  }
  475.  
  476.  
  477.  
  478. global proc paintEffectsValues( string $toolName ){
  479.  
  480.      // this method is exceptional, in that the values we are displaying
  481.     // are not really tool-related.  Therefore, this method can
  482.     // be empty.
  483.     
  484.     string $helpTag = "PaintEffectsTool";
  485.     toolPropertySetCommon $toolName "paintEffectsTool.xpm" $helpTag;
  486.     toolPropertySelect "paintEffects";
  487.  
  488.     string $parent = `toolPropertyWindow -q -location`;
  489.     strokeOptionsUpdate $parent;
  490.     
  491. }
  492.  
  493.